package com.bestv.bsr.core.service.impl.ah.remote;

import com.bestv.bsr.core.service.impl.ah.dto.AHRequestParam;
import com.bestv.bsr.core.service.impl.ah.dto.AHZYWLResponseDto;
import com.bestv.bsr.core.service.impl.ah.fallback.AHFallbackHandler;
import com.bestv.remote.annotation.RemoteFunction;
import com.bestv.remote.annotation.RemoteParam;
import com.bestv.remote.annotation.RemoteService;
import com.bestv.remote.callback.CallbackHandler;
import com.bestv.remote.enums.ParamType;
import org.springframework.http.HttpMethod;
import org.springframework.validation.annotation.Validated;

/**
 * 安徽移动 远程服务
 *
 * @author taojiacheng
 */
@RemoteService(baseUrl = "${recommend.ah.baseurl}", targetServerName = "AHYD")
@Validated
public interface AHRemoteService {

    /**
     * 安徽移动推荐接口
     */
    @RemoteFunction(value = "/ver/recommend", method = HttpMethod.POST,
            fallback = AHFallbackHandler.class, sentinelResource = "AH", block = AHFallbackHandler.class)
    AHZYWLResponseDto recommend(@RemoteParam(type = ParamType.FORM, name = "requestParam") AHRequestParam requestParam,
                                @RemoteParam(type = ParamType.AFTER_EXECUTE, name = "afterExecute") CallbackHandler afterExecute);


    /**
     * 安徽移动推荐接口
     */
    @RemoteFunction(value = "/ver/recommend", method = HttpMethod.POST,
            fallback = AHFallbackHandler.class, sentinelResource = "AH", block = AHFallbackHandler.class)
    AHZYWLResponseDto recommend(@RemoteParam(type = ParamType.FORM, name = "requestParam") AHRequestParam requestParam);


    /**
     * 容错接口 异常时调用
     */
    @RemoteFunction(value = "/ver/default", method = HttpMethod.POST)
    AHZYWLResponseDto fallback(@RemoteParam(type = ParamType.FORM, name = "requestParam") AHRequestParam requestParam);

}
